package org.example.order;

import com.alipay.remoting.exception.CodecException;
import com.alipay.remoting.serialization.SerializerManager;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.example.command.OrderCmd;

import java.io.Serializable;
import java.util.List;
@AllArgsConstructor
@Data
public class CmdPack implements Serializable {
    private long packNo;
    private List<OrderCmd> orderCmds;


    public byte[] serialize() throws CodecException {
        return SerializerManager.getSerializer(SerializerManager.Hessian2).serialize(this);
    }

    public static CmdPack deserialize(byte[] bytes) throws CodecException {
        return SerializerManager.getSerializer(SerializerManager.Hessian2).deserialize(bytes, CmdPack.class.getName());
    }
}
